﻿using ProjBackEnd.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ProjBackEnd.Areas.Sys.Models
{

    #region 菜单功能管理

    /// <summary>
    /// 菜单结果集
    /// </summary>
    public class ResultMenu : BaseResultInfo
    {
        /// <summary>
        /// 菜单列表
        /// </summary>
        public List<MenuAll> menulist { get; set; }

        /// <summary>
        /// 功能列表
        /// </summary>
        public List<FeatureAll> featurelist { get; set; }
    }

    /// <summary>
    /// 菜单操作请求
    /// </summary>
    public class ReqMenuManagement : BaseUserRequest
    {
        /// <summary>
        /// 待操作的菜单列表
        /// </summary>
        public List<MenuAll> menulist { get; set; }
    }

    /// <summary>
    /// 菜单信息
    /// </summary>
    public class MenuAll : BaseOperableEntity
    {
        /// <summary>
        /// 菜单id
        /// </summary>
        public int menuid { get; set; }

        /// <summary>
        /// 菜单代码
        /// </summary>
        [MaxLength(20, ErrorMessage = "菜单代码超过最大长度20")]
        public string menucd { get; set; }

        /// <summary>
        /// 菜单中文名称
        /// </summary>
        [MaxLength(50, ErrorMessage = "菜单中文名称超过最大长度50")]
        public string menuchn { get; set; }

        /// <summary>
        /// 菜单英文名称
        /// </summary>
        [MaxLength(50, ErrorMessage = "菜单英文名称超过最大长度50")]
        public string menueng { get; set; }

        /// <summary>
        /// 父级菜单id
        /// </summary>
        [Required]
        public int pmenuid { get; set; }

        /// <summary>
        /// 挂载的窗体名称
        /// </summary>
        public string formnm { get; set; }

        /// <summary>
        /// 打开方式
        /// </summary>
        public string opentp { get; set; }

        /// <summary>
        /// 建档人id
        /// </summary>
        public string createid { get; set; }

        /// <summary>
        /// 菜单序号
        /// </summary>
        [Required]
        public int menuorder { get; set; }

        /// <summary>
        /// 图标链接
        /// </summary>
        public string iconurl { get; set; }
    }

    /// <summary>
    /// 功能信息
    /// </summary>
    public class FeatureAll : BaseOperableEntity
    {
        /// <summary>
        /// 菜单id
        /// </summary>
        public int menuid { get; set; }

        /// <summary>
        /// 功能代码
        /// </summary>
        public string featurecd { get; set; }

        /// <summary>
        /// 功能名称
        /// </summary>
        public string featurenm { get; set; }

        /// <summary>
        /// 是否有效：Y-有效；N-无效
        /// </summary>
        public string isvalid { get; set; }
    }

    #endregion

    #region 角色及其分组信息管理

    /// <summary>
    /// 角色信息结果集
    /// </summary>
    public class ResultRoleInfo : BaseResultInfo
    {
        /// <summary>
        /// 角色及其分组列表
        /// </summary>
        public List<RoleGroupAll> rolegrouplist { get; set; }
    }

    /// <summary>
    /// 角色及其分组列表
    /// </summary>
    public class RoleGroupAll
    {
        /// <summary>
        /// 角色分组代码
        /// </summary>
        public string roletp { get; set; }

        /// <summary>
        /// 角色分组名称
        /// </summary>
        public string groupnm { get; set; }

        /// <summary>
        /// 分组序号
        /// </summary>
        public int grouporder { get; set; }

        /// <summary>
        /// 角色信息列表
        /// </summary>
        public List<RoleInfoAll> rolelist { get; set; }
    }

    /// <summary>
    /// 角色信息
    /// </summary>
    public class RoleInfoAll
    {
        /// <summary>
        /// 角色分组名称
        /// </summary>
        public string roletpnm { get; set; }

        /// <summary>
        /// 角色分组代码
        /// </summary>
        public string roletp { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        public int roleid { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string rolenm { get; set; }

        /// <summary>
        /// 角色所属公司代码
        /// </summary>
        public string comcd { get; set; }
    }

    /// <summary>
    /// 角色操作请求
    /// </summary>
    public class ReqRoleGroupManagement : BaseUserRequest
    {
        /// <summary>
        /// 角色分组信息
        /// </summary>
        public RoleGroupforCUD rolegroupinfo { get; set; }

        /// <summary>
        /// 角色信息
        /// </summary>
        public RoleforCUD roleinfo { get; set; }
    }

    /// <summary>
    /// 角色分组信息
    /// </summary>
    public class RoleGroupforCUD : BaseOperableEntity
    {
        /// <summary>
        /// 角色分组代码
        /// </summary>
        [RequiredConditional("optlb", "UD", ErrorMessage = "角色分组代码是必需的")]
        [MaxLength(15, ErrorMessage = "角色分组代码长度超限")]
        public string roletp { get; set; }

        /// <summary>
        /// 角色分组名称
        /// </summary>
        [MaxLength(50, ErrorMessage = "角色分组名称长度超限")]
        public string groupnm { get; set; }

        private int _iGrouporder = 10;
        /// <summary>
        /// 分组序号
        /// </summary>
        public int grouporder { get { return _iGrouporder; } set { _iGrouporder = value; } }

    }

    /// <summary>
    /// 角色信息
    /// </summary>
    public class RoleforCUD : BaseOperableEntity
    {
        /// <summary>
        /// 角色id
        /// </summary>
        [RequiredConditional("optlb","UD",ErrorMessage ="角色id是必需的")]
        public int roleid { get; set; }

        /// <summary>
        /// 角色所属分组
        /// </summary>
        public string roletp { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string rolenm { get; set; }

        /// <summary>
        /// 角色所属公司代码
        /// </summary>
        public string comcd { get; set; }
    }

    #endregion

    #region 角色成员管理

    /// <summary>
    /// 角色成员列表结果集
    /// </summary>
    public class ResultRoleMember : BaseResultInfo
    {
        /// <summary>
        /// 角色成员列表
        /// </summary>
        public List<RoleMember> rolememberlist { get; set; }
    }

    /// <summary>
    /// 角色成员信息
    /// </summary>
    public class RoleMember : BaseOperableEntity
    {
        /// <summary>
        /// 角色id
        /// </summary>
        public int roleid { get; set; }

        /// <summary>
        /// 成员系统id
        /// </summary>
        public string memberid { get; set; }

    }

    /// <summary>
    /// 角色成员操作请求
    /// </summary>
    public class ReqRoleMember : BaseUserRequest
    {
        /// <summary>
        /// 待操作的角色成员列表
        /// </summary>
        public List<RoleMember> rolememberlist { get; set; }
    }

    #endregion

    #region 角色权限管理

    /// <summary>
    /// 角色权限结果集
    /// </summary>
    public class ResultRolePermissionInfo : BaseResultInfo
    {
        /// <summary>
        /// 角色权限列表
        /// </summary>
        public List<RolePermission> rolepermissionlist { get; set; }
    }

    /// <summary>
    /// 角色权限信息
    /// </summary>
    public class RolePermission : BaseOperableEntity
    {
        /// <summary>
        /// 角色id
        /// </summary>
        public int roleid { get; set; }

        /// <summary>
        /// 菜单id
        /// </summary>
        public int menuid { get; set; }

        /// <summary>
        /// 功能代码
        /// </summary>
        [RequiredConditional("optlb","I",ErrorMessage ="功能代码是必需的")]
        public string featurecd { get; set; }

        /// <summary>
        /// 菜单中文名称
        /// </summary>
        public string menunmchn { get; set; }

        /// <summary>
        /// 功能名称
        /// </summary>
        public string featurenm { get; set; }
    }

    /// <summary>
    /// 角色权限操作请求
    /// </summary>
    public class ReqRolePermission : BaseUserRequest
    {
        /// <summary>
        /// 待操作的角色权限列表
        /// </summary>
        public List<RolePermission> rolepermissionlist { get; set; }
    }

    #endregion
}